home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
spwno413.zip
/
SPAWNO.DOC
< prev
next >
Wrap
Text File
|
1992-12-12
|
22KB
|
487 lines
SPAWNO v4.13 12/12/91 disk/EMS/XMS/INT15 swapping replacement for spawn()
(c) Copyright 1990,1991,1992 Ralf Brown. All Rights Reserved.
-----------------
LICENSE
This document and the associated header file, libraries, and source and
object modules may be freely copied provided that:
1) all of the files are copied as a group (such as in a single
archive). See below for a list of files.
2) the files are not modified in any way (including removal or
alteration of copyright notices or this license)
3) no charge beyond a cost-recovery fee not to exceed $5, or a
general telecommunications connection fee, is made
The source and/or object code comprising the public SPAWNO distribution
may be incorporated at no charge into programs which are distributed or
sold to others provided that:
1) credit is given in the documentation. A mention such as
"This product uses the SPAWNO routines by Ralf Brown
to minimize memory use while shelling to DOS and
running other programs."
is sufficient.
2) you drop me a line telling me that you are using SPAWNO and
in which product(s) you are using it (see addresses at the
end of this file). I'm interested in finding out how wide-
spread the use of SPAWNO becomes.
-----------------
DISCLAIMER
Although both I and others have tested the code which comprises SPAWNO,
it is entirely possible that SPAWNO may malfunction in environments or
under circumstances in which it has not been tested. This code is
provided AS IS, and the author disclaims any and all responsibility for
damages (both consequential and incidental) resulting from the use or
misuse of SPAWNO. Sole responsibility for determining the suitability
of the code rests with the user.
-----------------
FILES
The disk or archive you received should contain the following files:
SPAWNO.DOC this file
SPAWNO.H the header file providing prototypes for the functions
SPAWNx.LIB versions of the library for each of [T]iny, [S]mall,
[C]ompact, [M]edium, [L]arge, and [H]uge memory
models.
SPAWNTP.OBJ Turbo Pascal version of SPAWNO
SPAWNO.PAS Turbo Pascal unit encapsulating SPAWNO
SPAWN_MS.ZIP Microsoft C versions of compiler-specific functions
MSC.BAT replace Turbo C specific functions in libraries with
Microsoft C versions.
NOREPLAC.BAT remove replacements for the standard spawn..()
functions from the libraries.
SWAPTEST.C example program for testing
TEST.PAS example program for testing
SOURCE.ZIP archive containing partial source code for SPAWNO
_SPAWNO.H header file for recompiling library
*.C source for the spawn..() and spawn...o() functions
RULES.ASI shortened and modified Turbo C macro file
SPAWNO.INC include file for various important constants
SPAWNPTH.ASM source for the path search
CHECKEXT.ASM check for 'file', 'file.EXE', and 'file.COM'
SWAP_EMS.ASM support routines for swapping to EMS
SWAPLIST.ASM specify which swap types will be linked in
SPAWNENV.ASM make an environment block from an array of strings
SPAWNERR.ASM set _doserrno and errno
MAKEFILE
-----------------
WHAT'S NEW
Changes/fixes from versions 4.00 to 4.10:
Now swaps to disk with non-NULL swap list in large-data memory models
Now correctly deletes swap file if child program changes directories
If the given program name is "FOO", and both "FOO" and either
"FOO.COM" and/or "FOO.EXE" exist in the same directory, it will
now execute either "FOO.COM" or "FOO.EXE" rather than "FOO", as
both version 4.00 and the Borland library functions do. To
execute "FOO", pass "FOO." rather than just "FOO" to the function.
Fixed bug which may have led to a partially corrupted environment
in a few circumstances
Changes/fixes since version 4.10:
Fixed bug which caused the PSP to restore incorrectly after a spawn
when DS != SS.
Fixed bug introduced in v4.10 which caused a crash on return from the
child program if there was insufficient disk space for the swap
file.
Fixed error in va_start call in various *.C files. This problem
results in compile-time errors when compiling under BC++ in
certain modes (but the code compiled without warnings under
Turbo C 2.0).
-----------------
INSTALLATION
If you are using Turbo C, Turbo C++, or Borland C++, simply dearchive
the libraries and header file and place them where your compiler can
find them. If you are using Microsoft C, dearchive SPAWN_MS.ZIP and
then run the MSC batch file to replace the compiler-specific functions
in the libraries with Microsoft C versions. Please do not run this
batch file on your original copy of the libraries.
If you are using Turbo Pascal, unarchive SPAWNTP.OBJ and SPAWNO.PAS.
Compile SPAWNO.PAS and then add a USES SPAWNO; line to your program.
After that you can call the function SPAWN() as desired. The
distribution does not contain a pre-compiled version because .TPU
files are not compatible between different versions of Turbo Pascal.
-----------------
INSTRUCTIONS
As distributed, SPAWNO contains replacements for the standard spawn..()
functions. You can use SPAWNO with absolutely no changes to your
existing source code; however, you will probably want to call
init_SPAWNO() from main(), and include SPAWNO.H for that source file.
The initialization function takes two arguments: the first is a string
containing a list of directories (separated by semicolons) in which to
attempt to store the swap file when swapping to disk. The second
specifies which swap devices to attempt to use; it may be either
SWAP_ANY or the ORing or addition of any combination of SWAP_DISK,
SWAP_EMS, SWAP_EXT, and SWAP_XMS (such as SWAP_DISK|SWAP_XMS). If you
do not call init_SPAWNO(), the defaults are to attempt all swap devices
and to store the swap file in the current directory when swapping to
disk. init_SPAWNO() will set the swap file directory list to the first
of the following to have a non-NULL, non-empty value: the environment
variable SWAPDIR, the passed parameter, the environment variable TEMP,
and the environment variable TMP. Note that init_SPAWNO is the only
function in the library which uses these environment variables.
After making the above change, recompile your existing code, but include
the SPAWNO library in the link step. Note that SPAWNO does not support
the P_OVERLAY spawn type--any calls using that argument should be
replaced with the corresponding exec..() function. If a SPAWNO function
is called with P_OVERLAY, it simply returns an error.
For backwards compatibility with previous versions of SPAWNO, and for
those who (for whatever reason) require the use of both the swapping and
standard spawn..() functions, there is a second set of functions which
take an explicit swap directory argument. To use them, include the
header file SPAWNO.H. Then use the functions provided in this
archive--spawnvo(), spawnlo(), spawnvpo(), etc--as you would the
corresponding spawnv(), spawnl(), etc, except replace the first argument
by a string containing the path where the swap file is to be stored.
Note that the swap file path is required even when swapping to XMS, EMS,
or plain extended memory, as SPAWNO will swap to disk anyway if there is
not enough memory available.
If you require the use of both the swapping and standard spawn..()
functions, you will need to run the NOREPLAC.BAT batch file to remove
the modules containing the replacements for the standard functions or
arrange the linker command line such that SPAWNx.LIB is listed after the
standard runtime library (for Turbo/Borland C users, the latter requires
a separate TLINK command, as TCC/BCC places any libraries specified on
the command line prior to the runtime library). Please do not run
NOREPLAC on your original copy of the libraries, as the process is
destructive and cannot be reversed.
The spawn?p??() functions search for both .COM and .EXE files in the
current directory and then in the pathed